package controller;

import pojo.Food;
import service.*;

import vo.ResponseVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class FoodController {
    //获取service层对象
    /**
     * @param httpServletRequest
     * @param HttpServletResponse
     * @return
     *  */

    private IFoodService iFoodService= ServiceFactory.getIntance("FoodService");

    public ResponseVo<List<Food>> getFoodList(HttpServletRequest request, HttpServletResponse response) {
        // 调用service层获取用户列表并返回
        // /FoodController/getFoodList
        return iFoodService.getFoodList();
    }
    public ResponseVo<List<Food>> findFoodById(HttpServletRequest request, HttpServletResponse response) {
        String id=request.getParameter("id");
        // /FoodController/findFoodById?id=
        // 调用service层获取用户列表并返回
        return iFoodService.findFoodById(Integer.parseInt(id));
    }
}
